<?php
class Zend_View_Helper_Aclmenu extends Zend_View_Helper_Abstract
{
    public function aclmenu()
    {      
    	$svc = new App_Service_Doctrine(); 
    	$models = $svc->getAllEntites();
    	$menus = array();
    	
    	$menus[] = array(
    					'text'=>'modeling',
    					'leaf'=>true,
    					'href'=>'/modeling',
    					'hrefTarget'=>'content'
    				);
    				
    	foreach ($models as $m)
    	{
    		$menus[] = array(
    					'text'=>$m['displayname'],
    					'leaf'=>true,
    					'href'=>"/Doctrinext/index/model/{$m['name']}",
    					'hrefTarget'=>'content'
    				);
    	}
    	
    	$menus[] = array(
    					'text'=>'Statistics',
    					'leaf'=>true,
    					'href'=>'/Doctrinext/stats',
    					'hrefTarget'=>'content'
    				);
    	
    	$store = ZendX_Extjs_View_Helper_ExtComponent::js('Ext.data.TreeStore', array(
    		'storeId'=>'aclmenustroe',
    		'root'=>array(
    			'expanded'=>true,
    			'children'=>$menus,
    		)
    	));
    	
     	$js = ZendX_Extjs_View_Helper_ExtComponent::js('Ext.tree.Panel', array(
     		'renderTo'=>'aclmenu', 
     		'rootVisible'=>false,    		
     		//'width'=>200,
     		'title'=>'menu',
     		'store'=>'aclmenustroe'
     	)); 
     	
     	return $store . $js;
    }
}
?>